Telegram Group & Telegram Channel
Даны 2 таблицы с названиями orders и products c колонками "order_id", "customer_id", "product_id", "order_date", "quantity" и "product_id", "product_name", "unit_price". Какой из следующих SQL запросов вернет топ-5 покупателей, которые потратили больше всего в категории "Electronics"?

A) SELECT o.customer_id, SUM(o.quantity * p.unit_price) AS total_spent
FROM orders o JOIN products p ON o.product_id = p.product_id
WHERE p.product_name LIKE '%Electronics%'
GROUP BY o.customer_id
ORDER BY total_spent DESC
LIMIT 5;

B) SELECT o.customer_id, SUM(o.quantity * p.unit_price) AS total_spent
FROM orders o JOIN products p ON o.product_id = p.product_id
WHERE p.product_id IN (SELECT product_id FROM products WHERE product_name LIKE '%Electronics%')
GROUP BY o.customer_id
ORDER BY total_spent DESC
LIMIT 5;

C) SELECT o.customer_id, SUM(o.quantity * p.unit_price) AS total_spent
FROM orders o JOIN products p ON o.product_id = p.product_id
WHERE p.product_id IN (SELECT product_id FROM products WHERE product_name LIKE 'Electronics%')
GROUP BY o.customer_id
ORDER BY total_spent DESC
LIMIT 5;

D) SELECT o.customer_id, SUM(o.quantity * p.unit_price) AS total_spent
FROM orders o JOIN products p ON o.product_id = p.product_id
WHERE p.product_id IN (SELECT product_id FROM products WHERE product_name = 'Electronics')
GROUP BY o.customer_id
ORDER BY total_spent DESC
LIMIT 5;

Ответить на вопрос можно ниже ⬇️



tg-me.com/sql_for_qa/164
Create:
Last Update:

Даны 2 таблицы с названиями orders и products c колонками "order_id", "customer_id", "product_id", "order_date", "quantity" и "product_id", "product_name", "unit_price". Какой из следующих SQL запросов вернет топ-5 покупателей, которые потратили больше всего в категории "Electronics"?

A) SELECT o.customer_id, SUM(o.quantity * p.unit_price) AS total_spent
FROM orders o JOIN products p ON o.product_id = p.product_id
WHERE p.product_name LIKE '%Electronics%'
GROUP BY o.customer_id
ORDER BY total_spent DESC
LIMIT 5;

B) SELECT o.customer_id, SUM(o.quantity * p.unit_price) AS total_spent
FROM orders o JOIN products p ON o.product_id = p.product_id
WHERE p.product_id IN (SELECT product_id FROM products WHERE product_name LIKE '%Electronics%')
GROUP BY o.customer_id
ORDER BY total_spent DESC
LIMIT 5;

C) SELECT o.customer_id, SUM(o.quantity * p.unit_price) AS total_spent
FROM orders o JOIN products p ON o.product_id = p.product_id
WHERE p.product_id IN (SELECT product_id FROM products WHERE product_name LIKE 'Electronics%')
GROUP BY o.customer_id
ORDER BY total_spent DESC
LIMIT 5;

D) SELECT o.customer_id, SUM(o.quantity * p.unit_price) AS total_spent
FROM orders o JOIN products p ON o.product_id = p.product_id
WHERE p.product_id IN (SELECT product_id FROM products WHERE product_name = 'Electronics')
GROUP BY o.customer_id
ORDER BY total_spent DESC
LIMIT 5;

Ответить на вопрос можно ниже ⬇️

BY SQL для тестировщика


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/sql_for_qa/164

View MORE
Open in Telegram


SQL для тестировщика Telegram | DID YOU KNOW?

Date: |

The SSE was the first modern stock exchange to open in China, with trading commencing in 1990. It has now grown to become the largest stock exchange in Asia and the third-largest in the world by market capitalization, which stood at RMB 50.6 trillion (US$7.8 trillion) as of September 2021. Stocks (both A-shares and B-shares), bonds, funds, and derivatives are traded on the exchange. The SEE has two trading boards, the Main Board and the Science and Technology Innovation Board, the latter more commonly known as the STAR Market. The Main Board mainly hosts large, well-established Chinese companies and lists both A-shares and B-shares.

SQL для тестировщика from ru


Telegram SQL для тестировщика
FROM USA